<!-- TrainStudentStudyIndex.html -->
<!doctype html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
		<title>教师端培训底部导航</title>
		<link rel="stylesheet" type="text/css" href="../../css/api.css"/>
		<link rel="stylesheet" type="text/css" href="../../css/style.css"/>
		<style>
			body {
				background-color: #fff;
			}
			#footer {
				background-color: #fff;
				height: 52px;
				overflow: hidden;
			}
			#footer ul li {
				padding-top: 32px;
				padding-bottom: 4px;
				background: url() no-repeat center 4px;
				background-size: auto 24px;
				text-align: center;
				color: #979797;
				font-size: 12px;
			}
			#footer ul li.active {
				color: #18b4ed;
			}
			#footer ul li:nth-child(1) {
				background-image: url(../../icon/icon_xuexi_normal.png);
			}
			
			#footer ul li:nth-child(2) {
				background-image: url(../../icon/icon_wode_normal.png);
			}
			#footer ul li:nth-child(1).active {
				background-image: url(../../icon/icon_xuexi_selected.png);
			}
			
			#footer ul li:nth-child(2).active {
				background-image: url(../../icon/icon_wode_selected.png);
			}
		</style>
	</head>
	<body>
		<!-- <div id="white_div"></div> -->
		<div id="wrap" class="flex-wrap flex-vertical">
			<div id="main" class="flex-con"></div>
			<div id="footer" class="border-t">
				<ul class="flex-wrap" >
					<li tapmode="hover" onclick="randomSwitchBtn( this, 0 );" class="flex-con active" >
						培训
					</li>
					<li tapmode="hover" onclick="randomSwitchBtn( this, 2 );" class="flex-con" >
						我的
					</li>
				</ul>
			</div>
		</div>
	</body>
	<script type="text/javascript" src="../../script/api.js"></script>
	<script type="text/javascript" src="../../script/requestTool.js"></script>
	<script type="text/javascript" src="../../script/databaseOperation.js"></script>
	<!-- <script type="text/javascript" src="script/TrainUploadLearningRecord.js"></script> -->
	<script type="text/javascript">
		DBReady = function() {
			//设置学习记录上传更新
			// setupUploadRecord();
			setupNotifi();
			setupGroup();
		}
		function setupNotifi() {
			
		}

		function setupGroup() {
			var eHeaderLis = $api.domAll('header li'), frames = [];
			//添加培训页
			frames.push({
				name : 'train_frame',
				url : 'trainWindow.html',
				bgColor : '#fff',
				bounces : false,
				vScrollBarEnabled : false
			});
			//添加我的页
			frames.push({
				name : 'trainMine_frame',
				url : 'trainMineWindow.html',
				bgColor : '#fff',
				bounces : false,
				reload : true,
				vScrollBarEnabled : false,
				hScrollBarEnabled : false
			});
			var bottomH = $api.byId('footer').offsetHeight;
			//52
			var y = 0;
			//y : $api.dom('header').offsetHeight,
			var h = api.winHeight - bottomH;
			//h : $api.dom('#main').offsetHeight
			api.openFrameGroup({
				name : 'TrainFrameGroup',
				background : '#fff',
				scrollEnabled : false,
				rect : {
					x : 0,
					y : y,
					w : api.winWidth,
					h : h
				},
				index : 0,
				frames : frames,
				preload : 0
			}, function(ret, err) {
			});
		}




		// 随意切换按钮
		function randomSwitchBtn(tag, num) {
			//设置tabbar选中下标
			$api.setStorage('tabbarSelectedIndex', num);
			var eFootLis = $api.domAll('#footer li'), eHeaderLis = $api.domAll('header li'), index = 0;
			for (var i = 0, len = eFootLis.length; i < len; i++) {
				if (tag == eFootLis[i]) {
					index = i;
				} else {
					$api.removeCls(eFootLis[i], 'active');
					$api.removeCls(eHeaderLis[i], 'active');
				}
			}
			$api.addCls(eFootLis[index], 'active');
			$api.addCls(eHeaderLis[index], 'active');

			api.setFrameGroupIndex({
				name : 'TrainFrameGroup',
				index : index
			});


			if (num == 0) {
				api.sendEvent({
					name : 'showTrainFrameNotifi'
				});
				api.sendEvent({
					name : 'hideTrainMineFrameNotifi'
				});
			} else {
				api.sendEvent({
					name : 'hideTrainFrameNotifi'
				});
				api.sendEvent({
					name : 'showTrainMineFrameNotifi'
				});

			}
			// if (num == 1) {
			// 	alert("2来了");
			// 	api.sendEvent({
			// 		name : 'showTrainMineFrameNotifi'
			// 	});
			// } else {
			// 	alert("2走了");
			// 	api.sendEvent({
			// 		name : 'hideTrainMineFrameNotifi'
			// 	});
			// }
		}
	</script>
</html>